package homework;

/**
 * @ClassName Traffic
 * @Description TODO
 * @Author hp
 * @Date 2021/6/15 18:51
 * @Version 1.0
 **/
public class Traffic {
    public void drive() {
    }

    public static void main(String[] args) {
        Traffic[] traffic = {new Car(), new Bicycle()};
        for (Traffic t : traffic) {
            t.drive();
        }
    }
}

class Car extends Traffic {
    @Override
    public void drive() {
        System.out.println("驾驶汽车");
    }
}

class Bicycle extends Traffic {
    @Override
    public void drive() {
        System.out.println("骑自行车");
    }
}
